package com.welsy.authoring.business
{
	import mx.rpc.Fault;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.soap.mxml.WebService;	
	import mx.rpc.AbstractOperation;
	import com.adobe.cairngorm.business.ServiceLocator;
	import mx.rpc.IResponder;
	import mx.rpc.AsyncToken;
	import flash.utils.setTimeout;	
	import com.welsy.authoring.vo.CourseVO;
	import mx.collections.XMLListCollection;
	import com.welsy.authoring.vo.CourseComponentsVO;			

	/**
	  * Delegate for retrieving a test
	  * @author Welsy.org
	  * @version	$Revision: 1.1 $
	  */
	public class GetTestDelegate
	{
		/**
		  * Delegate set up for test retrieval
		  * @param responder The responder for the SOAP server response
		  */
		public function GetTestDelegate( responder : IResponder )
		{		
			this.service = ServiceLocator.getInstance().getWebService("TestService") as WebService;
			var o:AbstractOperation = service.getOperation("GetTestComponents");			
			this.responder = responder;
		}
										
		/**
		  * Call the server request for getting a test
		  * @param id The ID of the test to be retrieved from the server
		  */
		public function getTestComponents(id:int) : void
		{	
					
			var o:AbstractOperation = service.getOperation("GetTestComponents");
			o.arguments.GetTestComponentsRequest.TestID = id;
			
			var token:AsyncToken = service.GetTestComponents();
			// notify this command when the service call completes
			token.addResponder( responder );
		}	
		
		private var responder : IResponder;
		private var service : Object;
	}

}